Import OpenAPI Spec
Used to import actions from an OpenAPI specification. This allows you to automatically configure API tool actions based on a standard OpenAPI/Swagger specification file, streamlining the process of integrating external APIs.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/tools/import-openapi/{tool_id} |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/tools/import-openapi/{tool_id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"openapi": "3.0.0",
"info": {
"title": "Sample API",
"version": "1.0.0"
},
"paths": {
"/users": {
"get": {
"summary": "Get users",
"responses": {
"200": {
"description": "Successful response"
}
}
}
}
}
}'
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| tool_id | string | Yes | The unique identifier of the API tool. |
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Request Body
Request Body Schema
{
"additionalProp1": {}
}
Request Body Parameters
The request body should contain a valid OpenAPI specification object. The structure follows the OpenAPI Specification format (versions 2.0 or 3.0+).
| Field | Type | Required | Description |
|---|---|---|---|
| openapi | string | No | OpenAPI specification version (e.g., "3.0.0", "3.1.0"). |
| swagger | string | No | Swagger specification version (e.g., "2.0") for older specs. |
| info | object | No | API metadata including title, version, and description. |
| paths | object | No | Available API endpoints and their operations. |
| components | object | No | Reusable components like schemas, parameters, and responses. |
| servers | array | No | API server URLs and configuration. |
note
OpenAPI Specification Requirements
- The request body should be a valid OpenAPI/Swagger specification
- Supports OpenAPI 2.0 (Swagger), 3.0.x, and 3.1.x formats
- Can be provided as a JSON object or reference
- The specification should include at least the
pathsobject with API endpoints
tip
After importing an OpenAPI specification, the system will:
- Parse the OpenAPI/Swagger document
- Extract all API endpoints and operations
- Create corresponding actions in the API tool
- Configure request/response schemas automatically
- Set up authentication methods if defined in the spec
- Validate the specification format and structure
Response
Success Response (200 OK)
Returns an object containing the import status.
{
"is_success": true,
"item_id": "tool_12345",
"detail": "OpenAPI specification imported successfully. 15 actions created.",
"error": {}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_success | boolean | Indicates whether the import was successful. |
| item_id | string | The identifier of the API tool. |
| detail | string | Success or failure message with additional context. |
| error | object | Error details if the operation failed (empty if successful). |
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid.
{
"detail": [
{
"loc": [
"body",
"paths"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., body field). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | Successful Response | Success |
| 400 | Bad Request - Invalid OpenAPI specification | Bad Request |
| 404 | Not Found - API tool does not exist | Not Found |
| 422 | Validation Error - Invalid request parameters | Unprocessable Entity |